import {combineReducers} from 'redux';
import {AUTH_SUCCESS, DO_LOGOUT} from './action-types';

const initUserState = {
    user: '',
    type: ''
}
function user(state = initUserState,action) {
    switch (action.type) {
        case AUTH_SUCCESS:
            return {...action.data};
        case DO_LOGOUT:
            localStorage.removeItem('token');
            return initUserState;
        default:
            return state;
    }
}

export default combineReducers({
    user
})